package com.zhaotianhao.check.groupserver.api;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zhaotianhao.check.groupserver.common.JsonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Z-7
 * @Date 2022/4/1
 */
@RestController
@RequestMapping("item")
public class ItemController {
    @GetMapping("items")
    public JsonResult getItems(){
        String body = HttpRequest.get("http://192.168.127.142:8082/item/getItems")
                .timeout(10000)
                .execute()
                .body();
        JSONArray objects = JSONObject.parseArray(body);
        return JsonResult.successd(objects);
    }
}
